﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/admin/assets/css/layui.css">
    <link rel="stylesheet" href="/admin/assets/css/login.css">
    <script src="/admin/qrcode/jquery2.1.4.js"></script>
    <script src="/admin/layer/layer.js"></script>
    <title>汽车商城后台</title>
</head>
<body class="login-wrap">
    <div class="login-container">
    	<h3>汽车商城后台管理</h3>
        <form class="login-form" id="login" action="/admin/Login">
            <div class="input-group">
                <input type="text" id="user" name="user" class="input-field">
                <label for="user" class="input-label">
                    <span class="label-title">用户名</span>
                </label>
            </div>
            <div class="input-group">
                <input type="password" id="passWord" name="passWord" class="input-field">
                <label for="passWord" class="input-label">
                    <span class="label-title">密码</span>
                </label>

            </div>
            <button type="button" class="login-button">登录<i class="ai ai-enter"></i></button>
        </form>
    </div>
</body>
<script src="/admin/assets/layui.js"></script>

<script src="/admin/js/index.js" data-main="login"></script>
<script src="/admin/js/login.js" data-main="login"></script>

<script>
    $(function () {

        $(".login-button").click(function () {


            var windowId = layer.load()

            //ajax与服务器交互
            $.ajax({
                type: "POST",
                url: "/Login/user",
                data: $("#login").serialize(),//主要是分页和多条件参数数据
                dataType: "json",
                success: function (data) {
                    //关闭弹窗
                    layer.close(windowId);
                    //显示结果和跳转页面
                    layer.msg(data.msg)
                    if (data.code == 200) {
                        //登录成功，跳转到主页
                        location.assign("index.html");//这是css跳转页面
                    }
                }
            });
        })
    })
</script>
</html>